﻿<Page x:Class="SqlMetalIncludeGUI.SelectDbObjects"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:Me="clr-namespace:SqlMetalIncludeGUI"
      x:Name="_this" 
      WindowTitle="SqlMetalInclude GUI - Select DB Objects">
    <Page.Resources>
        <Me:Config x:Key="Config" />
    </Page.Resources>
    <DockPanel>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Bottom">
            <Button Margin="5" Content="Loading..." IsEnabled="False" x:Name="NextButton" Click="NextButton_Click" />
        </StackPanel>
        <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom">
            <Button Content="Select all" Margin="3" Click="SelectAll_Click" /> <Button Content="De-Select all" Margin="3" Click="DeselectAll_Click" />
        </StackPanel>
        <DockPanel DockPanel.Dock="Top">
            <TextBlock Text="Search: " DockPanel.Dock="Left" VerticalAlignment="Center" Margin="5,0,0,0" />
            <TextBox x:Name="searchBox" TextChanged="searchBox_TextChanged" />
        </DockPanel>
        <GroupBox Header="SqlMetalInclude output" Visibility="Collapsed" x:Name="sqlMetalOutputGroup" DockPanel.Dock="Bottom"
                  Height="300">
            <DockPanel>
                <TextBox Background="Black" Foreground="White" x:Name="sqlMetalIncludeOutput" TextWrapping="WrapWithOverflow" IsReadOnly="True" />
            </DockPanel>
        </GroupBox>
        <DataGrid 
            ItemsSource="{Binding Source={StaticResource Config}, Path=Default.DbObjects}" 
            AutoGenerateColumns="False"
            CanUserAddRows="False"
            CanUserDeleteRows="False"
            CanUserResizeRows="False"
            CanUserResizeColumns="False"
            CanUserReorderColumns="False"
            EnableRowVirtualization="True"
            ScrollViewer.IsDeferredScrollingEnabled="True"
            x:Name="dbObjectsDataGrid">
            <DataGrid.Columns>
                <DataGridCheckBoxColumn Binding="{Binding Path=Selected}" Header="Include" Width="Auto" />
                <DataGridTextColumn IsReadOnly="True" Binding="{Binding Path=Name}" Header="Name" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ListName}" Header="List Name" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ClassName}" Header="Class Name" Width="Auto" />
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</Page>
